import Vue from 'vue';
import App from './App';
import { router } from './router';
import 'amfe-flexible';
import 'vant/lib/index.css';
import './css/comm.less';
import './css/comm.scss';
import store from './store';

//原生api接口
import { Comm, androidback, _w9_wcallback } from './navigator/app.js';
Vue.prototype.Comm = Comm;
//+
// let hostApi="http://192.168.0.96:8888/";
Vue.prototype.ossApi = "https://hygm.oss-cn-shanghai.aliyuncs.com/";
Vue.prototype.baseURL = "https://hanyangkeji.top/hy/";
//+
//暴露原生方法回调（原生方法关键代码）
window.androidback = androidback;
window._w9_wcallback = _w9_wcallback;
window.Comm = Comm;

import Vant from 'vant';
Vue.use(Vant);
import { Notify, Toast, Dialog, Lazyload, ImagePreview, Tab, Tabs } from 'vant';
Vue.use(Notify).use(Toast).use(Dialog).use(Lazyload).use(ImagePreview).use(Tabs).use(Tab);
Vue.prototype.$notify = function (data) {
    console.log(data);
    if (data.type == "success") {
        this.$toast({
            type: 'success',
            message: data.message,
            duration: 3000
        })
    } else if (data.type == "danger") {
        this.$toast({
            type: 'fail',
            message: data.message,
            duration: 3000
        })
    } else {
        this.$toast(data.message)
    }
};
//接口导入
import api from './api/index.js';
Vue.use(api);
let top_ = 0
Comm.storage("isX", function (d) {
    if (d) {
        //top_ = 35
    } else if (Comm.ios()) {
        top_ = 20
    }
})

//全局过滤器
Vue.filter('minHeightFilter', function (top) {
    return 'min-height: calc(100vh - ' + (top + top_) + 'px);'
})

new Vue({
    router,
    el: '#app',
    store,
    render: h => h(App)
});